<template>
    <div>
      {{ sun }}
      <input type="text" v-model="firstName">
      <input type="text" v-model="lastName">
      <input type="text" v-model="fullName">
    </div>
  </template>
  
  <script>
  export default {
    data(){
      return{
        num1: 1,
        num2: 2,
        firstName: 'cong',
        lastName: 'zhi'
      }
    },
    computed:{
      sun(){
        console.log('计算sum');
        return this.unm1 + '-' + this.num2 
      },
      fullName: {
        get(){
          console.log('get');
          return this.firstName + '-' + this.lastName
        },
        set(val){
          console.log('set');
          let arr = val.split('-')
          this.firstName = arr[0]
          this.lastName = arr[1]
        }
      }
    }
  }
  </script>
  
  <style>
  
  </style>